//
//  NFSPlayBillTableView.m
//  NeedForSpeed
//
//  Created by 王国强 on 15/10/22.
//  Copyright © 2015年 Avenger. All rights reserved.
//

#import "NFSPlayBillTableView.h"

#import "NFSPlayBillTableViewCell.h"

@implementation NFSPlayBillTableView


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame Array:(NSMutableArray *)array
{
    self = [super initWithFrame:frame];
    if (self) {
        self.playBillArray = [NSMutableArray arrayWithArray:array];
        [self createTabelView:frame];
        
    }
    return self;
}
- (void)createTabelView:(CGRect)fram
{
    _playTabelView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, fram.size.width, fram.size.height) style:UITableViewStylePlain];
    [_playTabelView setBackgroundColor:[UIColor blackColor]];
    _playTabelView.delegate =self;
    _playTabelView.dataSource =self;
    [self addSubview:_playTabelView];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _playBillArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellId = @"cell";
    NFSPlayBillTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (!cell) {
        cell = [[NFSPlayBillTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
        
    }
    NFSDirectModel *model = [_playBillArray objectAtIndex:indexPath.row];
    [cell getModel:model];
    [cell setBackgroundColor:[UIColor blackColor]];
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}
@end
